package com.education.wisdom.controller;

import com.education.common.utils.LogUtil;
import com.education.wisdom.pojo.Label;
import com.education.wisdom.service.ILabelService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static com.education.common.core.BaseController.writeJSON;


/**
 * 标签 信息操作处理
 *
 * @author ruoyi
 * @date 2018-11-13
 */
@Controller
@CrossOrigin
@Slf4j
@ResponseBody
@Api(tags = {"评论标签信息"})
@RequestMapping("/web/label")
public class FullLabelController {

    @Autowired
    private ILabelService labelService;

    /**
     * 查询标签列表
     */
    @GetMapping("/list")
    @ResponseBody
    public void list(HttpServletResponse response, String bqType) throws Exception {
        log.info(LogUtil.LogInfo("查询标签", new Date()));
        Map<String, Object> map = new HashMap<>();
        map.put("bqType", bqType);
        List<Label> list = labelService.selectLabel(map);
        writeJSON(list, response, "200", "success");
    }
}
